package com.qiusuo0226.platform.controller;

import com.qiusuo0226.platform.annotation.RequestRecord;
import com.qiusuo0226.platform.annotation.RequestTimeLimit;
import com.qiusuo0226.platform.pojo.query.RequestRecordQuery;
import com.qiusuo0226.platform.service.RequestRecordService;
import com.qiusuo0226.mvc.util.JsonResultModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 接口访问记录 前端控制层
 * @author qiusuo
 * @date 2023/4/7 9:20
 */
@RestController
@RequestMapping("/manager/requestRecord")
@Slf4j
public class RequestRecordController {

    @Autowired
    private RequestRecordService requestRecordService;


    /**
     * 根据搜索条件获取请求记录列表
     * @param query 搜索条件
     * @return
     */
    @PostMapping("/list")
    @RequestRecord
    @RequestTimeLimit
    public JsonResultModel selectRecord(@RequestBody RequestRecordQuery query) {
        return JsonResultModel.success(requestRecordService.selectRecord(query));
    }
}
